home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / LITTLE / P3SRC.ZIP / ATARI / HFIELD.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-07  |  3.3 KB  |  112 lines

  1. /****************************************************************************
  2. *                   hfield.h
  3. *
  4. *  This module contains all defines, typedefs, and prototypes for HFIELD.C.
  5. *
  6. *  from Persistence of Vision(tm) Ray Tracer
  7. *  Copyright 1996 Persistence of Vision Team
  8. *---------------------------------------------------------------------------
  9. *  NOTICE: This source code file is provided so that users may experiment
  10. *  with enhancements to POV-Ray and to port the software to platforms other
  11. *  than those supported by the POV-Ray Team.  There are strict rules under
  12. *  which you are permitted to use this file.  The rules are in the file
  13. *  named POVLEGAL.DOC which should be distributed with this file. If
  14. *  POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  15. *  Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  16. *  Forum.  The latest version of POV-Ray may be found there as well.
  17. *
  18. * This program is based on the popular DKB raytracer version 2.12.
  19. * DKBTrace was originally written by David K. Buck.
  20. * DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  21. *
  22. *****************************************************************************/
  23.  
  24. #ifndef HFIELD_H
  25. #define HFIELD_H
  26.  
  27. #include "bbox.h"
  28. #include "boxes.h"
  29.  
  30.  
  31.  
  32. /*****************************************************************************
  33. * Global preprocessor defines
  34. ******************************************************************************/
  35.  
  36. #define HFIELD_OBJECT (BASIC_OBJECT+WATER_LEVEL_OK_OBJECT+SMOOTH_OK_OBJECT+HIERARCHY_OK_OBJECT)
  37.  
  38. #define HF_CACHE_SIZE 16
  39.  
  40. /* Generate additional height field statistics. */
  41.  
  42. #define HFIELD_EXTRA_STATS 1
  43.  
  44.  
  45. /*****************************************************************************
  46. * Global typedefs
  47. ******************************************************************************/
  48.  
  49. typedef struct HField_Struct HFIELD;
  50. typedef struct HField_Data_Struct HFIELD_DATA;
  51. typedef struct HField_Block_Struct HFIELD_BLOCK;
  52. typedef struct HField_Normal_Struct HFIELD_NORMAL;
  53. typedef short HF_Normals[3];
  54. typedef unsigned short HF_VAL;
  55.  
  56. struct HField_Normal_Struct
  57. {
  58.   DBL fx, fz;
  59.   VECTOR normal;
  60. };
  61.  
  62. struct HField_Block_Struct
  63. {
  64.   int xmin, xmax;
  65.   int zmin, zmax;
  66.   DBL ymin, ymax;
  67. };
  68.  
  69. struct HField_Data_Struct
  70. {
  71.   int References;
  72.   int cache_pos;
  73.   int Normals_Height;  /* Needed for Destructor */
  74.   int max_x, max_z;
  75.   HF_VAL min_y, max_y;
  76.   int block_max_x, block_max_z;
  77.   int block_width_x, block_width_z;
  78.   HF_VAL **Map;
  79.   HF_Normals **Normals;
  80.   HFIELD_NORMAL Normal_Cache[HF_CACHE_SIZE];
  81.   HFIELD_BLOCK **Block;
  82. };
  83.  
  84. struct HField_Struct
  85. {
  86.   OBJECT_FIELDS
  87.   TRANSFORM *Trans;
  88.   BOX *bounding_box;
  89.   HFIELD_DATA *Data;
  90. };
  91.  
  92.  
  93.  
  94. /*****************************************************************************
  95. * Global variables
  96. ******************************************************************************/
  97.  
  98. extern METHODS HField_Methods;
  99.  
  100.  
  101. /*****************************************************************************
  102. * Global functions
  103. ******************************************************************************/
  104.  
  105. HFIELD *Create_HField PARAMS((void));
  106. void   Compute_HField_BBox PARAMS((HFIELD *HField));
  107. void   Compute_HField PARAMS((HFIELD *H_Field, IMAGE *Image));
  108.  
  109.  
  110.  
  111. #endif
  112.